package com.sky.business.sys.event;

import lombok.Data;

import java.util.List;

/**
 * 任务状态
 */
@Data
public class TrackDispatchStatusEvent extends BaseEvent{

    /**
     * 元数据
     */
    private Metadata metadata;

    /**
     * 构造器
     * @param edgeId 边缘中心id
     * @param taskId 任务id
     * @param deviceIds 指定设备id列表
     * @param allowDeviceIds  允许选择的设备id列表
     * @param notFoundDeviceIds  不存在的设备id列表
     * @param notHeartbeatDeviceIds 没有心跳的设备id列表
     * @param busyDeviceIds 忙碌设备id列表
     * @param trackingDevices   分配任务的设备id列表
     */
    public TrackDispatchStatusEvent(String edgeId, String taskId, List<String> deviceIds, List<String> allowDeviceIds, List<String> notFoundDeviceIds, List<String> notHeartbeatDeviceIds,List<String> busyDeviceIds, List<String> trackingDevices) {
        super("TrackingDispatchStatus", edgeId);
        metadata = new Metadata();
        metadata.setTaskId(taskId);
        metadata.setDeviceIds(deviceIds);
        metadata.setAllowDeviceIds(allowDeviceIds);
        metadata.setNotFoundDeviceIds(notFoundDeviceIds);
        metadata.setNotHeartbeatDeviceIds(notHeartbeatDeviceIds);
        metadata.setBusyDeviceIds(busyDeviceIds);
        metadata.setTrackingDevices(trackingDevices);
    }

    /**
     * 追踪任务调度详情
     */
    @Data
    public static class Metadata{
        private String taskId;
        private List<String> deviceIds;
        private List<String> allowDeviceIds;
        private List<String> notFoundDeviceIds;
        private List<String> notHeartbeatDeviceIds;
        private List<String> busyDeviceIds;
        private List<String> trackingDevices;
    }
}
